<template>
	<view >
		<my-header bgColor="bg-gradual-blue" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">意见反馈</block>
		</my-header>
		<view class="fron">
            <view class="cu-form-group margin-top">
				<view class="title">反馈类型</view>
				<picker @change="PickerChange" data-key="back_type" :data-data="back_type_list" :value="back_type" :range="back_type_list">
					<view class="picker">
						{{back_type?back_type:'请选择反馈类型'}}
					</view>
				</picker>
			</view>
            <view class="cu-form-group textarea align-start margin-top">
				<view class="title">反馈内容</view>
				<textarea maxlength="-1" v-model="content"  placeholder="请输入您的反馈"></textarea>
			</view>
            <view class="cu-bar bg-white margin-top">
				<view class="action">
					图片上传
				</view>
				<view class="action">
					{{imgList.length}}/4
				</view>
			</view>
			<view class="cu-form-group">
				<view class="grid col-4 grid-square flex-sub">
					<view class="bg-img" v-for="(item,index) in show_imgList" data-key="imgList" :key="index" @tap="ViewImage" :data-url="imgList[index]">
					 <image :src="imgList[index]" mode="aspectFill"></image>
						<view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="index">
							<text class='cuIcon-close'></text>
						</view>
					</view>
					<view class="solids" @tap="ChooseImage" data-key="imgList" v-if="imgList.length<4">
						<text class='cuIcon-cameraadd'></text>
					</view>
				</view>
			</view>
        </view>
        <view class="col">
            <view class="cu-btn round lg btn" @click="submit()">提交反馈</view>
        </view>
	</view>
</template>

<script>
	
	export default {
		data() {
			return {
                back_type_list:[
                    "意见建议","BUG反馈"
                ],
                content:"",
                back_type:"",
                imgList:[],
                show_imgList:[]
			}
		},
		onLoad() {
            // this.initData()
           
            
    
		},
		methods: {
            ...uni.$input,
			async initData(){
				const res=await uni.$request({
				},"api/applet/about")
				this.content=res
				console.log(res);
            },
            async submit(){
                const formData={
                    typt:this.back_type,
                    content: this.content,
                    img_list:this.imgList
                }
                const res=  await uni.$request({
                    ...formData
                },'')
                console.log(formData);
            }
			
		}
	}
</script>

<style lang="scss">
	@import "./index";
</style>